package cn.gjxblog.aop.autoproxy.demo1;

import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * 采用 BeanNameAutoProxyCreator 自动代理创建器 （和Advisor无关）
 */
@Configuration
@ComponentScan("cn.gjxblog.aop.autoproxy")
public class AutoProxyConfig {

    @Bean
    public BeanNameAutoProxyCreator beanNameAutoProxyCreator(){
        BeanNameAutoProxyCreator beanNameAutoProxyCreator = new BeanNameAutoProxyCreator();
        beanNameAutoProxyCreator.setBeanNames("*ServiceImpl");
        beanNameAutoProxyCreator.setInterceptorNames("myMethodInterceptor");
        return beanNameAutoProxyCreator;
    }
}
